home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / gnu / gnulib / sipp / sphigs / include / sphigs.h < prev   
Encoding:
C/C++ Source or Header  |  1993-10-11  |  10.0 KB  |  312 lines

  1. /* $Id: sphigs.h,v 1.5 1993/03/09 02:00:54 crb Exp $ */
  2.  
  3. #ifndef SPHIGS_H_INCLUDED_ALREADY
  4. #define SPHIGS_H_INCLUDED_ALREADY
  5.  
  6. /* -------------------------------------------------------------------------
  7.              Public SPHIGS include file
  8.    ------------------------------------------------------------------------- */
  9.  
  10. #include "mat3.h"
  11. #include "srgp_sphigs.h"
  12. #include "srgppublic.h"
  13.  
  14. #ifdef SPHIGS_BOSS
  15. #define DECLARE
  16. #else
  17. #define DECLARE extern
  18. #endif
  19.  
  20.  
  21. /* -----------------------------  Constants  ------------------------------ */
  22.  
  23. /* LIMITATION CONSTANTS */
  24. #define DEFAULT_MAX_STRUCTURE_ID 15
  25. #define DEFAULT_MAX_VIEW_INDEX       5
  26. #define DEFAULT_MAX_LIGHT_INDEX      5
  27. #define DEFAULT_MAX_NAME      32
  28.  
  29. #define MAX_HIERARCHY_LEVEL      14
  30.  
  31. DECLARE short MAX_STRUCTURE_ID
  32. #ifdef SPHIGS_BOSS
  33.    = DEFAULT_MAX_STRUCTURE_ID
  34. #endif
  35.    ;
  36. DECLARE short MAX_VIEW_INDEX
  37. #ifdef SPHIGS_BOSS
  38.    = DEFAULT_MAX_VIEW_INDEX
  39. #endif
  40.    ;
  41. DECLARE short MAX_LIGHT_INDEX
  42. #ifdef SPHIGS_BOSS
  43.    = DEFAULT_MAX_LIGHT_INDEX
  44. #endif
  45.    ;
  46. DECLARE short MAX_NAME
  47. #ifdef SPHIGS_BOSS
  48.    = DEFAULT_MAX_NAME
  49. #endif
  50.    ;
  51.  
  52.  
  53. /* RENDERING MODE CONSTANTS */
  54. #define WIREFRAME_RAW      1
  55. #define WIREFRAME    2  /* default */
  56. #define FLAT         3
  57. #define LIT_FLAT     4
  58. #define GOURAUD         5
  59.  
  60. /* NETWORK DELETION TYPES */
  61. #define UNCONDITIONAL   1
  62. #define CONDITIONAL  2
  63.  
  64. /* MATRIX CONCATENATION TYPES */
  65. #define ASSIGN       1
  66. #define PRECONCATENATE     2
  67. #define POSTCONCATENATE    3
  68.  
  69. /* PROJECTION TYPES */
  70. #define ORTHOGRAPHIC 0
  71. #define PERSPECTIVE  1
  72.  
  73. /* EDGE FLAGS */
  74. #define EDGE_VISIBLE 0
  75. #define EDGE_INVISIBLE 1
  76.  
  77. /* IMPLICIT REGENERATION MODES */
  78. #define SUPPRESSED 1
  79. #define ALLOWED    2
  80.  
  81. /* RENDERING ALGORITHMS */
  82. #define RENDER_PAINTERS 0
  83. #define RENDER_BSP   1
  84.  
  85.  
  86. #include "elementType.h"
  87.  
  88.  
  89. /* -------------------------------  Types  -------------------------------- */
  90.  
  91. /* 2D */
  92. typedef struct { double x, y; }           NDC_point;
  93. typedef struct { NDC_point bottom_left, top_right; }  NDC_rectangle;
  94.  
  95. /* 3D */
  96. typedef MAT3vec         point;
  97. typedef MAT3vec      vector;
  98. typedef MAT3mat         matrix;
  99.  
  100. typedef short vertex_index;
  101.  
  102. typedef 
  103.    struct {
  104.       point position;
  105.       int   view_index;
  106.       int   button_chord[3];
  107.       int   button_of_last_transition;
  108.    } locator_measure;
  109. #define viewIndex view_index
  110. #define locatorMeasure locator_measure
  111.  
  112. typedef
  113.    struct {
  114.      int structureID;
  115.      int elementIndex;
  116.      int elementType;    /* symbolic constants in elementType.h */
  117.      int pickID;
  118.    } pickPathItem;
  119.  
  120. typedef pickPathItem pickPath[MAX_HIERARCHY_LEVEL];
  121.  
  122. typedef struct {
  123.      int pickLevel;
  124.      pickPath path;
  125.    } pickInformation;
  126.  
  127. typedef char   name;      /* a number from 1 to 32 */
  128.  
  129. /* -------------------------------  Macros  ------------------------------- */
  130.  
  131. #define SPH_beep           SRGP_beep
  132.  
  133. #define SPH_setModXform(A, B)   \
  134.                   A, SPH_setModelingTransformation (temp_matrix, B)
  135.  
  136. /*
  137.  * NOTE: in the original release of SPHIGS, the vector package used performed
  138.  * multiplications using row instead of column vectors, the result being that in
  139.  * order to use SPH_compose on transform matrices generated by SPHIGS, one had
  140.  * to multiply them in reverse order to make composite transforms.
  141.  *    Oddly enough, this was deemed counterintuitive, and SPH_compose has
  142.  * been replaced by SPH_composeMatrix, which multiplies transforms correctly (as
  143.  * described in the text), and the vector package now treats matrix mults as
  144.  * column vectors (also as found in the text).
  145.  *    SPH_oldComposeMatrix is provided here for the sake of backward
  146.  * compatibility, and the following macro ensures that programs written with the
  147.  * original (beta) version of SPHIGS will compile and work as intended.
  148.  *    
  149.  */
  150. #define SPH_compose     SPH_oldComposeMatrix
  151.  
  152. /* -----------------------------  Prototypes  ----------------------------- */
  153.  
  154. /* In sph_state.c: */
  155. void     SPH_begin (int width, int height, int color_planes_desired, 
  156.             int shades_per_flexicolor);
  157. void     SPH_end (void);
  158. void     SPH_setMaxStructureID (int);
  159. void     SPH_setMaxNameID (int);
  160. void     SPH_setMaxViewIndex (int);
  161. void     SPH_setMaxLightSourceIndex (int);
  162.  
  163. /* In sph_utility.c: */
  164. double * SPH_defPoint (double *pt, double x, double y, double z);
  165. NDC_rectangle  SPH_defNDCrectangle 
  166.                    (double lx, double by, double rx, double ty);
  167.  
  168. /* In sph_filter.c: */
  169. /* unimplemented */ void SPH_addToHiliteFilter (int viewID, name); 
  170. /* unimplemented */ void SPH_removeFromHiliteFilter (int viewID, name);
  171. void     SPH_addToInvisFilter (int viewID, name);
  172. void     SPH_removeFromInvisFilter (int viewID, name);
  173.  
  174. /* In sph_element.c: */
  175. void     SPH_addToNameSet (name);
  176. void     SPH_removeFromNameSet (name);
  177.  
  178. void     SPH_polyhedron (int numverts, int numfacets, 
  179.             point *verts, vertex_index *facets);
  180. void     SPH_fillArea (int vCount, point *vertices);
  181. void     SPH_polyMarker(int vCount, point *vertices);
  182. void     SPH_polyLine (int vCount, point *vertices);
  183. void     SPH_text (point origin, char *string);
  184.  
  185. void     SPH_setInteriorColor (int value);
  186. void     SPH_setLineStyle (int LINE_STYLE);
  187. void     SPH_setLineColor (int value);
  188. void     SPH_setLineWidthScaleFactor (double value);
  189. void     SPH_setEdgeFlag (int value);
  190. void     SPH_setEdgeStyle (int LINE_STYLE);
  191. void     SPH_setEdgeColor (int value);
  192. void     SPH_setEdgeWidthScaleFactor (double value);
  193. void     SPH_setMarkerStyle (int MARKER_STYLE);
  194. void     SPH_setMarkerColor (int value);
  195. void     SPH_setMarkerSizeScaleFactor (double value);
  196. void     SPH_setTextFont (int value);
  197. void     SPH_setTextColor (int value);
  198.  
  199. void     SPH_setModelingTransformation (matrix, int method);
  200. void     SPH_clearModelingTransformation (void);
  201. void     SPH_label (int);
  202. void     SPH_setPickIdentifier (int);
  203. void     SPH_executeStructure (int structID);
  204.  
  205. /* In sph_post.c: */
  206. void     SPH_postRoot (int structID, int viewID);
  207. void     SPH_unpostRoot (int structID, int viewID);
  208. void     SPH_unpostAllRoots (int viewID);
  209.  
  210. /* In sph_edit.c: */
  211. void     SPH_openStructure (int structID);
  212. void     SPH_closeStructure (void);
  213.  
  214. void     SPH_copyStructure (int structID);
  215.  
  216. void     SPH_setElementPointer (int elptr);
  217. int      SPH_inquireElementPointer (void);
  218. void     SPH_offsetElementPointer (int offset);
  219. void     SPH_moveElementPointerToLabel (int label);
  220.  
  221. void     SPH_deleteElement (void);
  222. void     SPH_deleteElementsInRange (int index1, int index2);
  223. void     SPH_deleteElementsBetweenLabels (int lab1, int lab2);
  224.  
  225. /* In sph_refresh.c: */
  226. void     SPH_setDoubleBufferingFlag (boolean);
  227. void     SPH_setRenderingMode (int viewindex, int value);
  228. void     SPH_setImplicitRegenerationMode (int mode);
  229. void     SPH_regenerateScreen (void);
  230.  
  231. /* In sph_view.c: */
  232. void     SPH_evaluateViewOrientationMatrix 
  233.                    (point  view_ref_point,
  234.           vector view_plane_normal, 
  235.           vector view_up_vector,
  236.           matrix vo_matrix /*varparm*/ );
  237.  
  238. void     SPH_evaluateViewMappingMatrix
  239.                    (double umin, double umax,
  240.           double vmin, double vmax,
  241.           int proj_type,  /* ORTHOGRAPHIC or PERSPECTIVE */
  242.           point proj_ref_point,
  243.           double front_plane_dist, 
  244.           double back_plane_dist,
  245.           double vp_minx, double vp_maxx, 
  246.           double vp_miny, double vp_maxy,
  247.           double vp_minz, double vp_maxz,
  248.           matrix vm_matrix /*varparm*/ );
  249.  
  250. void     SPH_setViewRepresentation 
  251.                    (int viewIndex,
  252.           matrix vo_matrix,
  253.           matrix vm_matrix,
  254.           double vp_minx, double vp_maxx, 
  255.           double vp_miny, double vp_maxy,
  256.           double vp_minz, double vp_maxz);
  257.           
  258. void     SPH_enableView (int viewIndex);
  259. void     SPH_disableView (int viewIndex);
  260.  
  261. void     SPH_setViewBackgroundColor (int viewIndex, int color);
  262. void     SPH_setViewRenderAlgorithm (int viewIndex, int algorithm);
  263.  
  264. void     SPH_setViewPointLightSource (int viewIndex, 
  265.           double u, double v, double n);
  266. void     SPH_addPointLightSource (int viewIndex, int lightIndex,
  267.           point position, boolean cameraRelative, 
  268.           double intensity, double attenuation);
  269. void     SPH_removePointLightSource (int viewIndex, int lightIndex);
  270.  
  271.  
  272. /* In sph_input.c: */
  273. #define     SPH_setInputMode        SRGP_setInputMode
  274. #define     SPH_waitEvent        SRGP_waitEvent
  275. #define     SPH_getKeyboard         SRGP_getKeyboard
  276. #define     SPH_sampleKeyboard         SRGP_sampleKeyboard
  277. #define     SPH_setKeyboardProcessingMode    SRGP_setKeyboardProcessingMode
  278. #define     SPH_setKeyboardEchoColor      SRGP_setKeyboardEchoColor
  279. #define     SPH_setKeyboardEchoFont       SRGP_setKeyboardEchoFont
  280. #define     SPH_setKeyboardMeasure     SRGP_setKeyboardMeasure
  281. #define     SPH_setLocatorEchoCursorShape    SRGP_setLocatorEchoCursorShape
  282. #define     SPH_setLocatorButtonMask      SRGP_setLocatorButtonMask
  283.  
  284. void      SPH_getLocator (locator_measure*);
  285. void      SPH_sampleLocator (locator_measure*);
  286. void      SPH_setLocatorMeasure (point position);
  287. void      SPH_setKeyboardEchoOrigin (point position);
  288.  
  289. void      SPH_pickCorrelate (point npc_position, int viewindex, 
  290.                 pickInformation *pickinfo);
  291.  
  292. /* In sph_modxform.c: */
  293. void  SPH_scale (double x, double y, double z, matrix result);
  294. void  SPH_rotateX (double angle, matrix result);
  295. void  SPH_rotateY (double angle, matrix result);
  296. void  SPH_rotateZ (double angle, matrix result);
  297. void  SPH_translate (double x, double y, double z, matrix result);
  298. void  SPH_oldComposeMatrix (matrix m1, matrix m2, matrix result);
  299. void  SPH_composeMatrix (matrix m1, matrix m2, matrix result);
  300.  
  301. /* In sph_attrib.c: */
  302. #define  SPH_loadFont         SRGP_loadFont
  303.  
  304. void SPH_loadCommonColor (int microcolorindex, char *name);
  305.  
  306.  
  307. /* ----------------------------  End of File  ----------------------------- */
  308.  
  309. #endif /* SPHIGS_H_INCLUDED_ALREADY */
  310.  
  311. #undef DECLARE
  312.